Skip to content

Fix session name too long error when creating from issues#327

Merged
brendanlong merged 2 commits intomainfrom
claude/a2cba291-33a1-444a-b1b7-bd96c1f5ca70
Apr 7, 2026
Merged

Fix session name too long error when creating from issues#327
brendanlong merged 2 commits intomainfrom
claude/a2cba291-33a1-444a-b1b7-bd96c1f5ca70

Conversation

@brendanlong
Copy link
Copy Markdown
Owner

Summary

  • Truncates auto-generated session names (from issue titles) to 100 characters
  • Adds maxLength attribute to the session name input field to prevent manual entry beyond the limit
  • Truncates fallback default names (repo + branch) to 100 characters
  • Extracts SESSION_NAME_MAX_LENGTH constant shared between client and server validation

Fixes #324

Test plan

  • Added test for truncation of long issue titles
  • All 362 existing tests pass
  • Manual: Create a session from an issue with a title longer than 100 characters — name should be truncated
  • Manual: Try typing more than 100 characters in the session name field — input should stop accepting

🤖 Generated with Claude Code

Truncate auto-generated session names from issue titles to 100 chars,
add maxLength to the name input field, and use a shared constant for
the limit across client and server validation.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request implements a 100-character limit for session names across the application, adding truncation logic to the form reducer, enforcing a maximum length on the UI input, and updating server-side validation. The reviewer noted that defining the shared constant within the client-side directory and importing it into the server-side router creates an undesirable dependency. To resolve this architectural anti-pattern, the constant should be moved to a shared directory like 'src/lib'.

import type { Repo } from '@/components/RepoSelector';
import type { Issue } from '@/lib/types';

export const SESSION_NAME_MAX_LENGTH = 100;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Defining SESSION_NAME_MAX_LENGTH in a UI-specific reducer file while also using it in the server-side router (src/server/routers/sessions.ts) creates an undesirable dependency from the server to the client/app directory. This can lead to client-side logic being inadvertently pulled into the server bundle. Consider moving this constant to a shared location like src/lib/constants.ts or src/lib/types.ts to maintain a clean separation of concerns.

import { sseEvents } from '../services/events';
import { createLogger, toError } from '@/lib/logger';
import { env } from '@/lib/env';
import { SESSION_NAME_MAX_LENGTH } from '@/app/new/form-reducer';
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Importing from the src/app directory into a server-side router is an architectural anti-pattern in Next.js. It violates the separation between UI/client logic and backend logic, and can cause issues with bundle boundaries. Please move SESSION_NAME_MAX_LENGTH to a shared utility or constants file (e.g., in src/lib) and import it from there in both the reducer and this router.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@brendanlong brendanlong merged commit 1ddb079 into main Apr 7, 2026
4 checks passed
@brendanlong brendanlong deleted the claude/a2cba291-33a1-444a-b1b7-bd96c1f5ca70 branch April 7, 2026 06:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Name too long issues

2 participants